package com.ecnu.sei.app.resources;

public class Classroom implements Comparable<Classroom> {
  
  private String classroomName;
  private int capacity;
  private static final int DEFAULT_CAPACITY = Integer.MAX_VALUE;
  
  public Classroom(String classroomName) {
    this(classroomName, DEFAULT_CAPACITY);
  }
  
  public Classroom(String classroomName, int capacity) {
    this.classroomName = classroomName;
    this.capacity = capacity;
  }
  
  
  public String getName() {
    return classroomName;
  }
  
  public int getCapacity() {
    return capacity;
  }
  
  @Override
  public int compareTo(Classroom other) {
     return this.classroomName.compareTo(other.getName());
  }

  
  @Override
  public String toString() {
    return "Classroom [classroomName="
        + classroomName + "]";
  }

  @Override
  public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + capacity;
    result = prime * result
        + ((classroomName == null) ? 0 : classroomName.hashCode());
    return result;
  }

  @Override
  public boolean equals(Object obj) {
    if (this == obj)
      return true;
    if (obj == null)
      return false;
    if (getClass() != obj.getClass())
      return false;
    Classroom other = (Classroom) obj;
    if (capacity != other.capacity)
      return false;
    if (classroomName == null) {
      if (other.classroomName != null)
        return false;
    } else if (!classroomName.equals(other.classroomName))
      return false;
    return true;
  }
  
  
  
}
